<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <style>
        input[type="text"],
        input[type="number"] {
            width: 200px;
        }
        select{
            width: 200px;
            height: 100px;
        }
    </style>
</head>

<body>
    <form id="register" action="http://www.sina.com.cn"></form>
    <form id="login" action="http://www.baidu.com" novalidate></form>
    <p>
        <label for="username">用户名</label>
        <input type="text" name="username" id="username" required form="login" 
        placeholder="请输入用户名">
    </p>
    <p>
        <label>年&emsp;龄
            <input type="number" name="age" id="age" min="0" max="120" form="login"
            placeholder="请输入年龄" step="5">
        </label>
    </p>
    <p>
        <select name="city" multiple form="login">
            <option value="1">城市1</option>
            <option value="2">城市2</option>
            <option value="3">城市3</option>
            <option value="4">城市4</option>
            <option value="5">城市5</option>
        </select>
    </p>
    <p>
        <button form="login">登录</button>
        <input type="submit" value="注册" form="register" 
                formaction="http://www.qq.com" formmethod="POST">
    </p>
    <script>
        // let username = document.querySelector('#username')
        // username.focus()

        let age = document.querySelector('#age')
        age.focus()
    </script>
</body>

</html>